package org.wdcode.core.lucene.search;

import org.wdcode.core.factory.BaseKeyFactory;
import org.wdcode.core.lucene.index.LuceneIndex;
import org.wdcode.core.lucene.index.LuceneIndexFactory;

/**
 * LuceneSearch工厂类
 * @author WD
 * @since JDK6
 * @version 1.0 2010-07-15
 */
public final class LuceneSearchFactory extends BaseKeyFactory<LuceneIndex, LuceneSearch> {
	// 工厂
	private final static LuceneSearchFactory	FACTORY;
	/**
	 * 静态初始化
	 */
	static {
		FACTORY = new LuceneSearchFactory();
	}

	/**
	 * 私有构造
	 */
	private LuceneSearchFactory() {
		super();
	}

	/**
	 * 获得工厂
	 * @return 工厂
	 */
	public final static LuceneSearchFactory getFactory() {
		return FACTORY;
	}

	/**
	 * 实例化一个LuceneSearch
	 * @return LuceneSearch
	 */
	public final LuceneSearch newInstance() {
		return newInstance(LuceneIndexFactory.getFactory().getInstance());
	}

	/**
	 * 实例化一个LuceneSearch
	 * @param index LuceneIndex
	 * @return LuceneSearch
	 */
	public final LuceneSearch newInstance(LuceneIndex index) {
		return new LuceneSearchImpl(index);
	}
}
